home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGMISC / PCSSP.LZH / PC-SSP.ZIP / POLYOPS.ZIP / PVSUB.FOR < prev   
Text File  |  1985-11-29  |  2KB  |  65 lines

  1. C
  2. C     ..................................................................
  3. C
  4. C        SUBROUTINE PVSUB
  5. C
  6. C        PURPOSE
  7. C           SUBSTITUTE VARIABLE OF A POLYNOMIAL BY ANOTHER POLYNOMIAL
  8. C
  9. C        USAGE
  10. C           CALL PVSUB(Z,IDIMZ,X,IDIMX,Y,IDIMY,WORK1,WORK2)
  11. C
  12. C        DESCRIPTION OF PARAMETERS
  13. C           Z     - VECTOR OF COEFFICIENTS FOR RESULTANT POLYNOMIAL,
  14. C                   ORDERED FROM SMALLEST TO LARGEST POWER
  15. C           IDIMZ - DIMENSION OF Z
  16. C           X     - VECTOR OF COEFFICIENTS FOR ORIGINAL POLYNOMIAL,
  17. C                   ORDERED FROM SMALLEST TO LARGEST POWER
  18. C           IDIMX - DIMENSION OF X
  19. C           Y     - VECTOR OF COEFFICIENTS FOR POLYNOMIAL WHICH IS
  20. C                   SUBSTITUTED FOR VARIABLE, ORDERED FROM SMALLEST TO
  21. C                   LARGEST POWER
  22. C           IDIMY - DIMENSION OF Y
  23. C           WORK1 - WORKING STORAGE ARRAY (SAME DIMENSION AS Z)
  24. C           WORK2 - WORKING STORAGE ARRAY (SAME DIMENSION AS Z)
  25. C
  26. C        REMARKS
  27. C           NONE
  28. C
  29. C        SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
  30. C           PMPY
  31. C           PADDM
  32. C           PCLA
  33. C
  34. C        METHOD
  35. C           VARIABLE OF POLYNOMIAL X IS SUBSTITUTED BY POLYNOMIAL Y
  36. C           TO FORM POLYNOMIAL Z. DIMENSION OF NEW POLYNOMIAL IS
  37. C           (IDIMX-1)*(IDIMY-1)+1. SUBROUTINE REQUIRES TWO WORK AREAS
  38. C
  39. C     ..................................................................
  40. C
  41.       SUBROUTINE PVSUB(Z,IDIMZ,X,IDIMX,Y,IDIMY,WORK1,WORK2)
  42.       DIMENSION Z(1),X(1),Y(1),WORK1(1),WORK2(1)
  43. C
  44. C     TEST OF DIMENSIONS
  45. C
  46.       IF (IDIMX-1) 1,3,3
  47.     1 IDIMZ=0
  48.     2 RETURN
  49. C
  50.     3 IDIMZ=1
  51.       Z(1)=X(1)
  52.       IF (IDIMY*IDIMX-IDIMY) 2,2,4
  53.     4 IW1=1
  54.       WORK1(1)=1.
  55. C
  56.       DO 5 I=2,IDIMX
  57.       CALL PMPY(WORK2,IW2,Y,IDIMY,WORK1,IW1)
  58.       CALL PCLA(WORK1,IW1,WORK2,IW2)
  59.       FACT=X(I)
  60.       CALL PADDM(Z,IDIMR,Z,IDIMZ,FACT,WORK1,IW1)
  61.       IDIMZ=IDIMR
  62.     5 CONTINUE
  63.       GO TO 2
  64.       END
  65.